//
//  FinderCollectionViewCell.m
//  InSuger
//
//  Created by dllo on 15/11/27.
//  Copyright © 2015年 Dior_3g. All rights reserved.
//

#import "FinderCollectionViewCell.h"

@implementation FinderCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell
{
    self.contentView.backgroundColor = [UIColor whiteColor];

    
    self.picImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, 2 * self.contentView.frame.size.height / 3)];
    [self.contentView addSubview:self.picImageView];

    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 2 * self.contentView.frame.size.height / 3, self.contentView.frame.size.width, 2 * self.contentView.frame.size.height / 9)];
    [self.contentView addSubview:self.nameLabel];

    //    self.nameLabel.font = [UIFont systemFontOfSize:13.0];
    self.nameLabel.numberOfLines = 2;
    
    self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.contentView.frame.size.width / 140, 8 * self.contentView.frame.size.height / 9, self.contentView.frame.size.width / 2, self.contentView.frame.size.height / 9)];
    [self.contentView addSubview:self.priceLabel];
    
    self.priceLabel.textColor = [UIColor redColor];
    self.priceLabel.font = [UIFont systemFontOfSize:13.0];
    
    self.favoriteImageView = [[UIImageView alloc] initWithFrame:CGRectMake(11 * self.contentView.frame.size.width / 16, 33 * self.contentView.frame.size.height / 36, self.contentView.frame.size.width / 16,1 * self.contentView.frame.size.height / 18)];
    [self.contentView addSubview:self.favoriteImageView];

    self.favoriteImageView.image = [UIImage imageNamed:@"No_Attention.png"];
    
    self.favoriteLabel = [[UILabel alloc] initWithFrame:CGRectMake(6 * self.contentView.frame.size.width / 8 , 8 * self.contentView.frame.size.height / 9, self.contentView.frame.size.width / 4, self.contentView.frame.size.height / 9)];
    [self.contentView addSubview:self.favoriteLabel];

    self.favoriteLabel.font = [UIFont systemFontOfSize:13.0];
    
    @weakify(self);
    [self addColorChangedBlock:^{
        @strongify(self);
        self.contentView.nightBackgroundColor = UIColorFromRGB(0x343434);
        self.contentView.normalBackgroundColor = [UIColor whiteColor];
        self.nameLabel.nightTextColor = [UIColor whiteColor];
        self.nameLabel.normalTextColor = [UIColor blackColor];
        self.favoriteLabel.nightTextColor = [UIColor whiteColor];
        self.favoriteLabel.normalTextColor = [UIColor blackColor];
    }];
    
}


@end
